{% extends "zato/index.html" %}

{% block html_title %}LB source code{% endblock %}

{% block "extra_css" %}
{% endblock %}

{% block "extra_js" %}

    {% comment %} jQuery {% endcomment %}
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.cookie.js"></script>

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/load_balancer.js"></script>

{% endblock %}

{% block "content" %}
<h2 class="zato">Clusters : <a href='{% url "cluster" %}?highlight={{ cluster.id }}'>{{ cluster.name }}</a> : Load balancer : Config source code view</h2>

<div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

<div class='page_prompt'>
<a href="{% url "lb-manage" cluster.id %}" class="common">Config GUI view</a>
<a href="{% url "lb-manage-source-code" cluster.id %}" class="common current">Config source code view</a>

{% if haproxy_alive.status %}
    <a href="{% url "lb-remote-command" cluster.id %}" class="common">Remote commands</a>
    {% if cluster.stats_uri %}
        <a href="http{% if lb_use_tls %}s{% endif %}://{{ cluster.lb_host }}:{{ cluster.stats_port }}{{ cluster.stats_uri }}" class="common">Statistics</a>
    {% endif %}
{% endif %}
</div>


<div id="markup">
    <form novalidate action="{% url "lb-manage-source-code-validate-save" cluster.id %}" method="post" id="lb-validate-save">
        <table id="data-table">
            <tr>
                <td>
                    {{ form.source_code }}
                </td>
            </tr>
            <tr>
                <td style="text-align:right">
                    <button id="validate" name="validate" type="submit">Validate config</button>
                    <button id="validate_save" name="validate_save" type="submit">Validate and save</button>
                </td>
            </tr>
        </table>
    </form>
</div>

{% endblock %}
